@echo off
echo 🚀 设置本地链 localhost:8545 配置...

echo 📡 检查本地链连接...
powershell -Command "try { $response = Invoke-RestMethod -Uri 'http://localhost:8545' -Method POST -Headers @{'Content-Type'='application/json'} -Body '{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1}' -ErrorAction Stop; Write-Host '✅ 本地链 localhost:8545 正在运行' } catch { Write-Host '❌ 本地链 localhost:8545 未运行，请先启动本地链'; Write-Host '💡 提示：可以使用以下命令启动本地链：'; Write-Host '   - Hardhat: npx hardhat node'; Write-Host '   - Ganache: npx ganache-cli --port 8545'; Write-Host '   - Anvil: anvil --port 8545'; exit /b 1 }"

echo 🔧 配置完成！
echo 📋 配置摘要：
echo    - 本地链 ID: 31337
echo    - RPC URL: http://localhost:8545
echo    - 默认链: LOCALHOST (开发环境)
echo    - 支持的功能: Swap, Farms, Pools, Lottery 等

echo.
echo 🔄 请重启开发服务器以应用配置：
echo    pnpm run dev

pause
